/*
============================================================================
Name        : CeStockMainGridView from eStockMainGridView.h
Author      : 
Version     :
Copyright   : Your copyright notice
Description : CeStockMainGridView implementation
============================================================================
*/

// INCLUDE FILES
#include <aknviewappui.h>
#include "eStockMainGridView.h"
#include "eStockMainGridContainer.h"
#include "Toolbar.h"

#include "Block.h"


void CeStockMainGridView::ConstructL()
{
    CBaseView::ConstructL();
}

CeStockMainGridView::~CeStockMainGridView()
{
}

TUid CeStockMainGridView::Id() const
{
	return KeStockMainGridViewId;
}

void CeStockMainGridView::DoActivateL(
                                      const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
                                      const TDesC8& /*aCustomMessage*/)
{
    if (!iContainer)
    {
        /*iContainer = new (ELeave) CeStockMainGridContainer;
        iContainer->SetMopParent(this);
        iContainer->ConstructL( ClientRect() );*/
        iContainer = CeStockMainGridContainer::NewL(AppUi()->ApplicationRect());
        AppUi()->AddToStackL( *this, iContainer );
    } 
    else
    {
        AppUi()->AddToStackL( *this, iContainer );
        CGlobal* pGlobal = CGlobal::Static();
        pGlobal->iTradeToolbarType = BASECOMMON->iToolbar->ButtonType();
        BASECOMMON->iToolbar->SetButtonType(pGlobal->iMainToolbarType);
        if(iContainer->Revolve())
        {
        	iContainer->SetSize(TSize(BASECOMMON->m_nScreenWidth, BASECOMMON->m_nScreenHeight));
        	iContainer->SizeChanged();	
        }
        iContainer->InitEnv();
        iContainer->MakeVisible(ETrue);
    }
    CeStockAppUi* ui = static_cast<CeStockAppUi*>(AppUi());
    ui->m_BaseCommon->iToolbar->SetObserver(iContainer);
}

void CeStockMainGridView::DoDeactivate()
{
    if (iContainer)
    {
        iContainer->MakeVisible(EFalse);
        if(BASECOMMON)
        	BASECOMMON->m_bShowKB = EFalse;
        //iToolbarType = BASECOMMON->iToolbar->ButtonType();
        AppUi()->RemoveFromViewStack(*this, iContainer);
//        delete iContainer;
//        iContainer = NULL;
    }
}

// End of File

